#include "methodFactory.h"
#include "txtMethod.h"
#include "xmlMethod.h"
#include <exception>

using std::exception;

IMethod* MethodFactory::createMethod(string type){
	try{
		if(type.compare("txt") == 0)
			return createTXT();
		if(type.compare("xml") == 0)
			return createXML();
		return NULL;
	}catch (exception e) {			
		throw "Cannot create method";
	}
}

IMethod* MethodFactory::createTXT(){
	return new MethodTXT();
}

IMethod* MethodFactory::createXML(){
	return new MethodXML();
}


